package com.fingard.dsp.bank.directbank.psbc11.util;

import com.fingard.FGBiz;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.InvalidPropertiesFormatException;
import java.util.Properties;

public class FtpProperty {
	String propertyFileName = null;
	String fileName = "ftpProperty.xml";
	private String filePath = null;
	Properties pps;

	public FtpProperty() {
		filePath = FGBiz.DSPHOME_Parent + File.separator + "config" + File.separator + "portfiles" + File.separator + "PSBC11";
		if (filePath == null) {
			File fi = new File(filePath);
			filePath = fi.getAbsolutePath();
		}
		StringBuffer sb = new StringBuffer();
		sb.append(filePath);
		sb.append(File.separator);
		sb.append(fileName);
		propertyFileName = sb.toString();
		pps = new Properties();
		loadProperty();
	}

	public void loadProperty() {
		try {
			pps.loadFromXML(new FileInputStream(propertyFileName));
		} catch (InvalidPropertiesFormatException e) {
			e.printStackTrace();
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public void displayProperty() {
		pps.list(System.out);
	}
}
